package xyz.chaobei.controller.page;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import xyz.chaobei.entity.OrgPermissionEntity;
import xyz.chaobei.service.OrgPermissionService;

import java.util.List;
import java.util.Map;

/**
 * @Author MRC
 * @Description 权限页面
 * @Date 16:14 2020/7/27
 **/
@Controller
@RequestMapping("orgPermission")
public class PageOrgPermissionController {

    @Autowired
    private OrgPermissionService orgPermissionService;

    @GetMapping("view")
    public String view(Map<String, Object> map) {

        List<OrgPermissionEntity> list = orgPermissionService.findAllPermission();
        map.put("permission", list);

        return "system/orgPermission";
    }

    /**
     * @return java.lang.String
     * @Author MRC
     * @Description 添加信息
     * @Date 15:12 2020/7/29
     * @Param []
     **/
    @GetMapping("add")
    public String add(Map<String, Object> map, Integer parent, Integer type) {
        map.put("parent", parent);
        map.put("type", type);
        return "system/permissionEdit";
    }

    /**
     * 编辑权限页面
     * @param map
     * @param id
     * @return
     */
    @GetMapping("edit")
    public String edit(Map<String, Object> map,Integer id,Integer type) {
        map.put("id", id);
        map.put("type", type);
        return "system/permissionEdit";
    }


}
